Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request creates a new Enum,
enum.userFlag
, creates a new Resolver,Resolver.userFlag()
, a new User getter,get.badges()
, and a new User method,User:hasBadge(User-Flag-Resolvable)
. These all allow for Badges support.get.badges()
returns an array of strings which represent the badge's name (which matches up with the Enum).User:hasBadge()
returns a boolean indicating whether or not the user has the specified User-Flag-Resolvable.Most of this was derived from Message Flags to maintain consistency.
Both the getter and the method have been tested.
One thing to note it that the
staff
badge does not seem to be able to be read due to its bit. I wasn't entirely sure what to do with the enum so I ended up keeping it. Another thing I wasnt so sure about was whether User:hasBadge() should return the flag value, or the badge name. It was agreed upon in the Discordia server that the badge name would be easier to handle.The raw property of a User that provides the functionality of Badges is
User._public_flags
. The documentation can be found here.